home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / TSR / TSRSRC35 / IPX.PAS < prev    next >
Pascal/Delphi Source File  |  1993-10-21  |  4KB  |  135 lines

  1. {**************************************************************************
  2. *   IPX - unit of IPX functions                                           *
  3. *   Copyright (c) 1991,1993 Kim Kokkonen, TurboPower Software.            *
  4. *   May be freely distributed and used but not sold except by permission. *
  5. *                                                                         *
  6. *   Version 3.0 9/24/91                                                   *
  7. *     first release                                                       *
  8. *   Version 3.1 11/4/91                                                   *
  9. *     no change                                                           *
  10. *   Version 3.2 11/22/91                                                  *
  11. *     no change                                                           *
  12. *   Version 3.3 1/8/92                                                    *
  13. *     no change                                                           *
  14. *   Version 3.4 2/14/92                                                   *
  15. *     no change                                                           *
  16. *   Version 3.5 10/18/93                                                  *
  17. *     no change                                                           *
  18. ***************************************************************************}
  19.  
  20. {$R-,S-,I-,V-,B-,F-,A-,E-,N-,G-,X-}
  21.  
  22. unit IPX;
  23.   {-IPX functions needed for RELNET}
  24.  
  25. interface
  26.  
  27. type
  28.   PhysicalNodeAddress = array[1..6] of Byte;
  29.  
  30.   FragmentDescriptor  =
  31.     record
  32.       Address         : Pointer;              {the data}
  33.       Size            : Word;                 {the size of the data}
  34.     end;
  35.  
  36.   IpxEcbPtr = ^IpxEcb;
  37.   IpxEcb =
  38.     record
  39.       Link            : IpxEcbPtr;            {link to next IPXECB}
  40.       EsrAddress      : Pointer;              {Event Service Routine}
  41.       InUse           : Byte;                 {inuse semaphore}
  42.       CompletionCode  : Byte;                 {error code}
  43.       SocketNumber    : Word;                 {the session socket}
  44.       IpxWorkSpace    : LongInt;              {reserved for internal use}
  45.       DriverWorkSpace : Array[1..12] of Byte; {reserved}
  46.       ImmediateAddress: PhysicalNodeAddress;  {the internet address}
  47.       FragmentCount   : Word;                 {the number of buffers}
  48.       FD1             : FragmentDescriptor;   {buffer 1}
  49.       FD2             : FragmentDescriptor;   {buffer 2}
  50.       FD3             : FragmentDescriptor;   {buffer 3}
  51.       FD4             : FragmentDescriptor;   {buffer 4}
  52.     end;
  53.  
  54. function IpxInstalled : Boolean;
  55.   {-Return True if IPX is installed}
  56.  
  57. procedure CloseSocket(Socket : Word);
  58.   {-Close specified socket number (after swapping hi-lo)}
  59.  
  60. function CancelEvent(var ECB : IPXECB) : Byte;
  61.   {-Cancel IPX event}
  62.  
  63. procedure ScheduleSpecialEvent(Delay : Word; var ECB : IPXECB);
  64.   {-Schedule a special event}
  65.  
  66.   {=======================================================================}
  67.  
  68. implementation
  69.  
  70. var
  71.   IpxOfs : Word;
  72.   IpxSeg : Word;
  73.  
  74. function IpxInstalled : Boolean; assembler;
  75. asm
  76.   MOV     AX,[IpxOfs]
  77.   OR      AX,[IpxSeg]
  78.   MOV     AL,00
  79.   JZ      @Done
  80.   INC     AL
  81. @Done:
  82. end;
  83.  
  84. procedure CloseSocket(Socket : Word); assembler;
  85. asm
  86.   MOV     AX,[IpxOfs]
  87.   OR      AX,[IpxSeg]
  88.   JZ      @Done
  89.   MOV     BX,0001
  90.   MOV     DX,Socket
  91.   CALL    DWORD PTR [IpxOfs]
  92. @Done:
  93. end;
  94.  
  95. function CancelEvent(var ECB : IPXECB) : Byte; assembler;
  96. asm
  97.   MOV     AX,[IpxOfs]
  98.   OR      AX,[IpxSeg]
  99.   MOV     AL,$FF
  100.   JZ      @Done
  101.   MOV     BX,0006
  102.   LES     SI,ECB
  103.   CALL    DWORD PTR [IpxOfs]
  104. @Done:
  105. end;
  106.  
  107. procedure ScheduleSpecialEvent(Delay : Word; var ECB : IPXECB); assembler;
  108. asm
  109.   MOV     AX,[IpxOfs]
  110.   OR      AX,[IpxSeg]
  111.   JZ      @Done
  112.   MOV     BX,0007
  113.   MOV     AX,Delay
  114.   LES     SI,ECB
  115.   CALL    DWORD PTR [IpxOfs]
  116. @Done:
  117. end;
  118.  
  119. procedure CheckIpx; assembler;
  120. asm
  121.   MOV     AX,$7A00
  122.   INT     $2F
  123.   CMP     AL,$FF
  124.   JZ      @StoreIpxPtr
  125.   XOR     DI,DI
  126.   MOV     ES,DI
  127. @StoreIpxPtr:
  128.   MOV     [IpxOfs],DI
  129.   MOV     [IpxSeg],ES
  130. end;
  131.  
  132. begin
  133.   CheckIpx;
  134. end.
  135.